//
//  PRGPUImageLUTFilter.m
//
//  Created by Json on 2023/8/18.
//

#import "GPUImageLUTFilter.h"
#import "GPUImagePicture.h"
#import "GPUImageLookupFilter.h"

@implementation GPUImageLUTFilter

- (instancetype)initWithLUTImage:(UIImage *)lutImage {
    if (self = [super init]) {
        lookupImageSource = [[GPUImagePicture alloc] initWithImage:lutImage];
        GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init];
        [self addFilter:lookupFilter];
        
        [lookupImageSource addTarget:lookupFilter atTextureLocation:1];
        [lookupImageSource processImage];
        
        self.initialFilters = @[lookupFilter];
        self.terminalFilter = lookupFilter;
    }
    return self;
}
@end
